/* 4K Rhythm Game - 科技感样式 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1e3e 100%);
    color: #00ffff;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-x: hidden;
}

/* 容器 */
.game-container {
    max-width: 1000px;
    width: 100%;
    background: rgba(10, 14, 39, 0.8);
    border: 2px solid #00ffff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 0 50px rgba(0, 255, 255, 0.3),
                inset 0 0 30px rgba(0, 255, 255, 0.1);
}

/* 标题 */
.header {
    text-align: center;
    margin-bottom: 20px;
}

.game-title {
    font-size: 2.5em;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 5px;
}

/* 故障效果 */
.glitch {
    position: relative;
    display: inline-block;
    color: #00ffff;
    animation: glitch-text 3s infinite;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    left: 2px;
    text-shadow: -2px 0 #ff00ff;
    clip: rect(24px, 550px, 90px, 0);
    animation: glitch-anim 2s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -2px 0 #00ff00;
    clip: rect(85px, 550px, 140px, 0);
    animation: glitch-anim 3s infinite linear alternate-reverse;
}

@keyframes glitch-text {
    0%, 90%, 100% {
        text-shadow: 0 0 10px #00ffff, 0 0 20px #00ffff;
    }
    95% {
        text-shadow: 0 0 20px #ff00ff, 0 0 40px #ff00ff;
    }
}

@keyframes glitch-anim {
    0% {
        clip: rect(30px, 9999px, 70px, 0);
    }
    20% {
        clip: rect(90px, 9999px, 20px, 0);
    }
    40% {
        clip: rect(10px, 9999px, 100px, 0);
    }
    60% {
        clip: rect(60px, 9999px, 40px, 0);
    }
    80% {
        clip: rect(20px, 9999px, 80px, 0);
    }
    100% {
        clip: rect(50px, 9999px, 30px, 0);
    }
}

/* 信息栏 */
.info-bar {
    display: flex;
    justify-content: space-around;
    gap: 20px;
    padding: 15px;
    background: rgba(0, 255, 255, 0.05);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 5px;
}

.info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.info-item .label {
    font-size: 0.8em;
    color: #00ffff;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.7;
}

.info-item .value {
    font-size: 1.5em;
    font-weight: bold;
    color: #00ff88;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.8);
}

/* 游戏区域 */
.game-wrapper {
    position: relative;
    margin: 20px auto;
    display: flex;
    justify-content: center;
}

#gameCanvas {
    border: 2px solid #00ffff;
    border-radius: 5px;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.5),
                inset 0 0 20px rgba(0, 255, 255, 0.1);
    background: #0a0e27;
}

/* 判定反馈 */
.judgment-feedback {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3em;
    font-weight: bold;
    opacity: 0;
    pointer-events: none;
    text-transform: uppercase;
    letter-spacing: 3px;
    transition: all 0.3s ease;
}

.judgment-feedback.perfect {
    opacity: 1;
    color: #00ffff;
    text-shadow: 0 0 20px #00ffff, 0 0 40px #00ffff;
    animation: judgment-pop 0.3s ease;
}

.judgment-feedback.great {
    opacity: 1;
    color: #00ff00;
    text-shadow: 0 0 20px #00ff00, 0 0 40px #00ff00;
    animation: judgment-pop 0.3s ease;
}

.judgment-feedback.good {
    opacity: 1;
    color: #ffff00;
    text-shadow: 0 0 20px #ffff00, 0 0 40px #ffff00;
    animation: judgment-pop 0.3s ease;
}

.judgment-feedback.miss {
    opacity: 1;
    color: #ff0000;
    text-shadow: 0 0 20px #ff0000, 0 0 40px #ff0000;
    animation: judgment-pop 0.3s ease;
}

/* Drag音符判定反馈 */
.judgment-feedback.drag {
    opacity: 1;
    color: #ff00ff;
    text-shadow: 0 0 20px #ff00ff, 0 0 40px #ff00ff;
    animation: judgment-pop 0.3s ease;
}

.judgment-feedback.hold {
    opacity: 1;
    color: #ffd700;
    text-shadow: 0 0 20px #ffd700, 0 0 40px #ffd700;
    animation: judgment-hold 0.5s ease;
}

@keyframes judgment-hold {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0;
    }
    30% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

@keyframes judgment-pop {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* 按键提示 */
.key-hints {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0;
    pointer-events: none;
}

.key-hint {
    width: 100px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    font-weight: bold;
    color: #00ffff;
    background: rgba(0, 255, 255, 0.1);
    border: 2px solid rgba(0, 255, 255, 0.5);
    border-bottom: none;
    transition: all 0.1s ease;
}

.key-hint.active {
    background: rgba(0, 255, 255, 0.3);
    color: #ffffff;
    text-shadow: 0 0 10px #00ffff;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.8),
                inset 0 0 20px rgba(0, 255, 255, 0.5);
    transform: translateY(-5px);
}

/* 控制面板 */
.control-panel {
    margin: 20px 0;
    padding: 20px;
    background: rgba(0, 255, 255, 0.05);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 5px;
}

.control-group {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.control-group label {
    color: #00ffff;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 1px;
    min-width: 150px;
}

.control-group input[type="file"] {
    flex: 1;
    padding: 8px;
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.5);
    border-radius: 3px;
    color: #00ffff;
    font-family: inherit;
}

.control-group input[type="range"] {
    flex: 1;
    height: 5px;
    background: rgba(0, 255, 255, 0.2);
    border-radius: 5px;
    outline: none;
    -webkit-appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 15px;
    height: 15px;
    background: #00ffff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.8);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 15px;
    height: 15px;
    background: #00ffff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.8);
    border: none;
}

/* 皮肤选择下拉框 */
.skin-select {
    flex: 1;
    padding: 8px 12px;
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.5);
    border-radius: 3px;
    color: #00ffff;
    font-family: inherit;
    font-size: 0.95em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.skin-select:hover {
    background: rgba(0, 255, 255, 0.2);
    border-color: #00ffff;
}

.skin-select:focus {
    outline: none;
    border-color: #00ffff;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.skin-select option {
    background: #0a0e27;
    color: #00ffff;
    padding: 8px;
}

/* 乐曲选择区域 */
.song-select-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.song-select-group .btn {
    flex: 0 0 auto;
    padding: 8px 15px;
    font-size: 0.9em;
}

/* 乐曲信息显示 */
.song-info {
    padding: 15px;
    margin: 10px 0;
    background: rgba(0, 255, 255, 0.05);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.song-title {
    font-size: 1.3em;
    color: #00ffff;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.song-artist {
    font-size: 1em;
    color: #00ff88;
}

.song-difficulty {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(255, 0, 255, 0.2);
    border: 1px solid rgba(255, 0, 255, 0.5);
    border-radius: 3px;
    color: #ff00ff;
    font-size: 0.9em;
    font-weight: bold;
    text-transform: uppercase;
    width: fit-content;
}

/* 本地文件折叠区域 */
.local-file-section {
    margin: 15px 0;
    padding: 10px;
    background: rgba(255, 136, 0, 0.05);
    border: 1px solid rgba(255, 136, 0, 0.3);
    border-radius: 5px;
}

.local-file-section summary {
    color: #ff8800;
    cursor: pointer;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 5px;
    transition: all 0.3s ease;
}

.local-file-section summary:hover {
    color: #ffaa00;
    text-shadow: 0 0 10px rgba(255, 136, 0, 0.5);
}

.local-file-section[open] summary {
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 136, 0, 0.3);
    padding-bottom: 10px;
}

.local-file-section .control-group {
    margin-bottom: 10px;
}

.local-file-section .control-group:last-child {
    margin-bottom: 0;
}


/* 按钮 */
.btn {
    padding: 10px 20px;
    font-family: inherit;
    font-size: 1em;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    border: 2px solid;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: transparent;
}

.btn-primary {
    color: #00ffff;
    border-color: #00ffff;
}

.btn-primary:hover:not(:disabled) {
    background: #00ffff;
    color: #0a0e27;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

.btn-secondary {
    color: #00ff88;
    border-color: #00ff88;
}

.btn-secondary:hover:not(:disabled) {
    background: #00ff88;
    color: #0a0e27;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
}

.btn-danger {
    color: #ff0088;
    border-color: #ff0088;
}

.btn-danger:hover:not(:disabled) {
    background: #ff0088;
    color: #0a0e27;
    box-shadow: 0 0 20px rgba(255, 0, 136, 0.5);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 使用说明 */
.instructions {
    margin-top: 20px;
    padding: 20px;
    background: rgba(0, 255, 255, 0.05);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 5px;
}

.instructions h3 {
    color: #00ffff;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 1.2em;
}

.instructions ul {
    list-style: none;
    padding-left: 0;
}

.instructions li {
    margin-bottom: 10px;
    padding-left: 20px;
    position: relative;
    color: #00ff88;
    line-height: 1.6;
}

.instructions li::before {
    content: "▹";
    position: absolute;
    left: 0;
    color: #00ffff;
}

kbd {
    display: inline-block;
    padding: 3px 8px;
    font-family: inherit;
    font-size: 0.9em;
    color: #00ffff;
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.5);
    border-radius: 3px;
    box-shadow: 0 2px 0 rgba(0, 255, 255, 0.3);
    margin: 0 2px;
}

.instructions a {
    color: #ff00ff;
    text-decoration: none;
    border-bottom: 1px solid #ff00ff;
    transition: all 0.3s ease;
}

.instructions a:hover {
    color: #ffffff;
    border-bottom-color: #ffffff;
    text-shadow: 0 0 10px #ff00ff;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-title {
        font-size: 1.5em;
        letter-spacing: 3px;
    }

    .info-bar {
        flex-direction: column;
        gap: 10px;
    }

    #gameCanvas {
        max-width: 100%;
        height: auto;
    }

    .control-group {
        flex-direction: column;
        align-items: flex-start;
    }

    .control-group label {
        min-width: auto;
    }

    .control-group input[type="file"],
    .control-group input[type="range"] {
        width: 100%;
    }
}

/* 加载动画 */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* 扫描线效果 */
.game-container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        transparent 50%,
        rgba(0, 255, 255, 0.03) 50%
    );
    background-size: 100% 4px;
    pointer-events: none;
    animation: scanline 8s linear infinite;
}

@keyframes scanline {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(4px);
    }
}
